home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: watserv3.uwaterloo.ca!athena
- From: sdbay@watnow.uwaterloo.ca (Stephen Bay)
- Subject: Question: references to variables within classes
- Message-ID: <DKy0MC.3nA@watserv3.uwaterloo.ca>
- Sender: news@watserv3.uwaterloo.ca
- Nntp-Posting-Host: cnts2p06.uwaterloo.ca
- Organization: University of Waterloo
- X-Newsreader: News Xpress Version 1.0 Beta #4
- Date: Wed, 10 Jan 1996 02:08:36 GMT
-
- Hi,
-
- Is it possible in C++ to use variables within a class as parameters for a
- constructor of an object contained within that class? I've tried compiling the
- following code and my compiler chokes on the list iter declaration within the
- class dodo - it doesn't recognize CityList and gives a syntax error. All the
- other statements compile fine though.
-
- -stephen
-
-
- #include "slist.hpp"
-
- NISList<int *> CityList;
- NISListIter<int *> CityListIter(CityList);
-
- struct bird
- {
- NISList<int *> CityList;
- NISListIter<int *> CityListIter();
- };
-
- class dodo
- {
- public:
- NISList<int *> CityList;
- chokes here-> NISListIter<int *> CityListIter(CityList);
- };
-
- main()
- {
- NISList<int *> CityList;
- NISListIter<int *> CityListIter(CityList);
- };
-
-
-